import {Injectable,NestMiddleware, Inject } from '@nestjs/common'
import {Request,Response,NextFunction} from 'express'
import { WINSTON_LOGGER_TOKEN } from 'src/log/logger.module';
 
@Injectable()
class GetPathUrl implements NestMiddleware {
  // 注入日志
  @Inject(WINSTON_LOGGER_TOKEN)
  private logger;
  
  use (req:Request, res:Response, next:NextFunction) {
    this.logger.log(req.originalUrl, 'middleware  GetPathUrl ======>')
    next()
  }
}

export { GetPathUrl }